package car.Postal.Grimentz;

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;

import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;


public class XmlParser {
	
	public ArrayList<OverlayItem> parse (InputSource payload) throws ParserConfigurationException, SAXException, IOException
	{
		
		SAXParserFactory spf = SAXParserFactory.newInstance();  
		SAXParser sp = spf.newSAXParser();  
		XMLReader xr = sp.getXMLReader();  
		stationXMLHandler myXMLHandler = new stationXMLHandler();  
		   xr.setContentHandler(myXMLHandler); 
		   xr.parse(payload);  
		   return(myXMLHandler.getListeBus());
	}
	
	
	
	
}



